package com.viknix.threadpool.manager.example.queue;

import com.viknix.threadpool.manager.client.spi.CustomBlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

/**
 * @Author: Dongqi
 * @Date: 2021/10/26 19:05
 * @Version 1.0
 * @Description: 自定义阻塞队列示例，同时需要添加META-INF:services:com.viknix.threadpool.manager.client.spi.CustomBlockingQueue文件
 */
public class ExampleBlockingQueue implements CustomBlockingQueue {

    /**
     * 获取自定义阻塞队列code
     *
     * @return 自定义阻塞队列 code
     */
    @Override
    public Integer getCode() {
        return 100;
    }

    @Override
    public String getName() {
        return "example-blocking-queue";
    }

    /**
     * 构建自定义阻塞队列对象
     *
     * @return 自定义阻塞队列
     */
    @Override
    public BlockingQueue generateBlockingQueue() {
        return new ArrayBlockingQueue(15);
    }
}
